package com.stox.shared.core.util;

import java.util.Comparator;

import com.stox.shared.core.model.Scrip;
import com.stox.shared.core.model.intf.HasScrip;

public class HasScripComparator implements Comparator<HasScrip> {
	
	private final NameableComparator<Scrip> nameableComparator = new NameableComparator<Scrip>();

	@Override
	public int compare(HasScrip o1, HasScrip o2) {
		if(null == o1 && null != o2){
			return -1;
		}else if(null != o1 && null == o2){
			return 1;
		}else if(o1 != null && o2 != null){
			return nameableComparator.compare(o1.getScrip(), o2.getScrip());
		}
		return 0;
	}
	
	
}
